package 笔试.科大讯飞;

import java.util.Scanner;

/**
 * @author:谢君臣
 * @Date:2021/10/10-20:25
 * @version:1.0
 * @function:
 */
public class Main02 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] num = new int[50];
        for (int i = 0; i < 50; i++) {
            num[i] = scanner.nextInt();
        }
        int x = scanner.nextInt();
        int index = select(num, x);
        if (1 <= index && index <= 5) {
            System.out.println("A+");
        } else if (index >= 6 && index <= 15) {
            System.out.println("A0");
        } else if (index >= 16 && index <= 30) {
            System.out.println("B+");
        } else if (index >= 31 && index <= 35) {
            System.out.println("B0");
        } else if (index >= 36 && index <= 45) {
            System.out.println("C+");
        } else if (index >= 46 && index <= 48) {
            System.out.println("C0");
        } else if (index >= 49 && index <= 50) {
            System.out.println("F");
        }
    }

    private static int select(int[] num, int x) {
        int n = num.length;
        int max, min;
        for (int i = 0; i < n; i++) {
            max = i;
            for (int j = i + 1; j < n; j++) {
                if (num[max] < num[j]) {
                    max = j;
                }
            }
            if (num[max] == x) {
                return i + 1;
            }
            min = num[i];
            num[i] = num[max];
            num[max] = min;
        }
        return n;
    }
}
